/**
*      author: Y_Yao
*      created: 2025-04-20 13:22:23
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
string s;
int ans;
int n;

void dfs(int i,int sum,int cur)
{
    if(i >= n - 1)
    {
        ans += sum + cur;
        return;
    }

    int next = s[i + 1] - '0';
    dfs(i+1,sum,cur * 10 + next);
    dfs(i+1,sum + cur,next);
}

void solve()
{
    cin >> s;
    n = s.size();
    int st = s[0] - '0';
    dfs(0,0,st);
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    // cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}